import Field from 'winged/utils/wt-model-field'

export default {
	title: '病程记录',
	name: 'course',
	tableName: 'process_note',
	query: {
		method: 'GET',
		url: 'doctor/patient/progress/note',
		transfer: true,
		pagination: true,
		extraParams: [
			'case_id',
		]
	},

    count: {
        method: 'GET',
        url: 'doctor/patient/progress/note/count',
        transfer: true,
        extraParams: [
            'case_id',
        ],
    },
	new: {
		method: 'POST',
		url: 'doctor/patient/progress/note',
		transfer: true,
		extraParams: [
			'case_id',
		]
	},
	update: {
		method: 'PUT',
		url: 'doctor/patient/progress/note',
		transfer: true
	},
	delete: {
		method: 'DELETE',
		url: 'doctor/patient/progress/note',
		transfer: true
	},
	id_field: {
		// 用于修改、删除操作的字段名
		name: 'note_id',
		// id字段查询结果中的tableName默认为'id'
		// tableName: 'id'
	},
	single: false,
	fields: [
		{
			label: '病程名称',
			type: Field.types.select,
			multiple: false,
			query: {
				url: 'doctor/patient/progress/note/type',
				method: 'GET',
				transfer: true,
				pagination: true,
				useAutoFilter: true,
				allowEmptyQuery: true,
				extraParams: [
					'case_id',
				],
				filterParam: 'type_name',
				label: 'noteTypeName',
				value: 'id',
				allowAdd: true,
				addMethod: 'POST',
				addParam: 'type_name',
			},
			name: 'note_type_id',
			tableName: 'noteType',
			rules: [
				{ type: 'number', required: true, message: '请选择病程名称', trigger: 'change' }
			]
		}, {
			label: '病程名称',
			type: Field.types.text,
			display: true,
			summary: true,
			noSave: true,
			tableName: 'noteTypeName'
		}, {
			label: '记录时间',
			type: Field.types.date,
			display: true,
			name: 'note_date',
			tableName: 'noteDate',
			rules: [
				{ type: 'date', required: true, message: '请选择记录时间', trigger: 'blur' }
			]
		},{
			label: '备注',
			type: Field.types.textarea,
			display: true,
			name: 'comment',
			tableName: 'comment'
		}, {
			label: '图片',
			type: Field.types.images,
			display: true,
			summary: true,
			name: 'image_urls',
			tableName: 'noteImages',
			uploadByComponent: true,
			saveAsJson: true,
			preSubmit: true,
		}
	]
};